package com.dgut.web;

import com.dgut.service.DownLoadService;
import com.dgut.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author GooRay
 * 创建于 2020/6/21
 */
@Controller
public class DownLoadController {

    @Autowired
    DownLoadService downLoadService;

    @Autowired
    UserService userService;

    @RequestMapping("/admin")
    public String Admin(){
        return "admin";
    }


    @RequestMapping("/DownLoad")
    public void DownLoad(HttpServletRequest request, HttpServletResponse response) {
        String typename = request.getParameter("typename");
        if("PDF".equals(typename)){
            downLoadService.DownLoadPDF(request,response);
        }else{
            downLoadService.DownLoadEXCEL(request,response);
        }
    }
}
